<template>
	<view style="background-color: #fff; height: 100%;">
		<!-- <view class="bg-white p20 ppoc" >
			<swiper style="height: 100%;" @change="huadong" :indicator-dots="true" >
				<swiper-item v-for="(item,index) in images" :key="index" style="height: 100%;" >
					<image :src="baseUrl+item" @click="app.showImg(baseUrl+item)"
						style="width: 100%;height: 100%;" mode="aspectFit"></image> 
				</swiper-item> 
			</swiper>
		</view> -->
		<image class="imageiw" src="/static/img/lunbot.jpg"></image>
		<view class="ppols">
			<swiper class="lpoi" :indicator-dots="true" indicator-color="#C4C3C9"
				indicator-active-color="#F7674E !important" @change="change">
				<swiper-item v-for="(item,index) in images" :key="index">
					<image mode="widthFix" class="ppoc" :src="baseUrl+item"></image>
				</swiper-item>
				<!-- <swiper-item v-for="(item,index) in urllist" :key="index">
					<image mode="widthFix" class="ppoc" :src="item.url" @click="ppoc"></image>
				</swiper-item> -->
			</swiper>
			<button class="butio" @click="baocun">保存相册</button>
		</view>
	</view>
</template>

<script>
	import bottomShare from '@/components/bottomShare';
	export default {
		components: {
			bottomShare
		},
		data() {
			return {
				is_wxmp: 0,
				baseUrl: this.config.baseUrl,
				images: [],
				urlppo: [],
				tagetar: 0,
			}
		},
		onLoad(options) {
			this.getImg();
		},
		
		onShow: function() {},
		computed: {},
		onReady() {},
		methods: {
			change(e) {
				this.tagetar = e.detail.current
			},
			ppoc(item) {
				this.app.showImg(this.baseUrl + item)
			},
			baocun() {
				this.urlppo = this.baseUrl + this.images[this.tagetar]
				console.log(this.urlppo);
				let _this = this
				uni.saveImageToPhotosAlbum({
					filePath: _this.urlppo,
					success: function(res) {
						uni.showToast({
							title: '图片保存成功',
							icon: 'none',
						});
					},
					fail(err) {
						console.log(err,'图片保存失败');
					}
				})
			},
			getImg() {
				//#ifdef MP-WEIXIN
				this.is_wxmp = 1;
				//#endif
				this.$u.post('member/api.users/getShareImg', {
					isnew: 1,
					is_wxmp: this.is_wxmp,
				}).then(res => {
					if (res.code == 0) {
						this.app.showModal(res.msg, -1);
					} else {
						this.images = res.data;
					}
				});
			}
		}
	}
</script>

<style lang="scss">
	.imageiw {
		width: 750rpx;
		height: 356rpx;
	}

	.ppols {
		width: 558rpx;
		height: 970rpx;
		background: #FFFFFF;
		border-radius: 23rpx;
		border: 5px solid #FFFFFF;
		position: absolute;
		top: 124rpx;
		left: 50%;
		transform: translate(-50%);
		box-shadow: 0 0 10rpx 10rpx #dbd2d2;

		.lpoi {
			height: 100%;
		}

		.ppoc {
			width: 538rpx;
			height: 970rpx;
			border-radius: 30rpx;
		}
	}

	.butio {
		width: 469rpx;
		height: 85rpx;
		background: #FFA81D;
		border-radius: 43rpx;
		margin: 0 auto;
		margin-top: 80rpx;
		font-weight: 400;
		font-size: 34rpx;
		color: #FFFFFF;
	}
</style>